1 <?
2 if
(isset($_POST['butSaveLoai'])) {
3     $name=$_POST[
'name'];
4     $thutu=$_POST[
'thutu'];
5     $parent=$_POST[
'parent'];
6     $status=($_POST[
'chkShow']!=''?1:0);
7             
8     $name = trim($_POST[
'name']);
9     
if ($name=="")
10     {
11         echo
"<p align=center class='err'>B&#7841;n ch&#432;a nh&#7853;p tên danh m&#7909;c</p>";
12     }
13     
else
14     {
15         
if (!empty($_POST['oldid'])) {
16             $oldid = $_POST[
'oldid'];
17             $sql =
"update help_cat set name='".$name."', parent='".$parent."', thutu='".$thutu."', status='".$status."' where id='".$oldid."'";
18         }
19         
else
20             $sql =
"insert into help_cat (name,parent,status,thutu,date) values ('".$name."','".$parent."','".$status."','".$thutu."',SYSDATE())";
21         
if (mysql_query($sql,$con)) {
22             echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t thành công</p><br>";
23             echo
"<script>window.location='index.php?act=help_category&page=".$_REQUEST['page']."&code=1'</script>";
24         }
25         
else echo "<p align=center class='err'>Không th&#7875; c&#7853;p nh&#7853;t</p>";
26         
27     }
28 }
29 ?>
30
31 <?
32     
if (isset($_GET['id'])) {
33         $oldid=$_GET[
'id'];
34         $sql =
"select * from help_cat where id='".$oldid."'";
35         
if ($result = mysql_query($sql,$con)) {
36             $row=mysql_fetch_array($result);
37             $name=$row[
'name'];
38             $parent=$row[
'parent'];
39             $status=$row[
'status'];
40             $sortorder=$row[
'thutu'];
41         }
42     }
43 ?>
44 <script language=
"Javascript1.2"><!-- // load htmlarea
45 _editor_url =
"htmlarea/"; // URL to htmlarea files
46 var
win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
47 if
(navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
48 if
(navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
49 if
(navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
50 if
(win_ie_ver >= 5.5) {
51   document.write(
'<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
52   document.write(
' language="Javascript1.2"></scr' + 'ipt>');
53 }
else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
54 // --></script>

55
56 <form method=
"POST" action="index.php?">
57 <input type=hidden name=
"act" value="help_category_m">
58 <input type=hidden name=
"oldid" value="<? echo $oldid; ?>">
59 <input type=hidden name=
"page" value="<? echo $_REQUEST['page']; ?>">
60 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
61   <tr>
62     <td width=
"45%" height="20" class="title" align="center">Thêm m&#7899;i / C&#7853;p nh&#7853;t
63     : Danh mục trợ giúp</td>
64   </tr>
65   <tr>
66     <td width=
"45%">
67     <table border=
"0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
68       <tr>
69         <td width=
"15%" class="smallfont">
70         <p align=
"right">Tên danh m&#7909;c</td>
71         <td width=
"1%" class="smallfont">
72         <font color=
"#FF0000">*</font></td>
73         <td width=
"83%" class="smallfont">
74         <INPUT
value="<? echo $name; ?>" TYPE="text" NAME="name" CLASS=textbox size="34"></td>
75       </tr>
76       <tr>
77         <td width=
"15%" class="smallfont" align="right">
78         Footer</td>
79         <td width=
"1%" class="smallfont" align="right">
80         &nbsp;</td>
81         <td width=
"83%" class="smallfont">
82         <input type=
"checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
83       </tr>
84           <tr>
85         <td width=
"15%" class="smallfont" align="right">
86         Thu&#
7897;c danh m&#7909;c</td>
87         <td width=
"1%" class="smallfont" align="center">&nbsp;
88         </td>
89         <td width=
"83%" class="smallfont">
90         <
select size="1" name="parent" >
91         <option
value="0">Danh mục gốc</option>
92 <?
93         $cats=GetListCatHelp(
0);
94         
foreach ($cats as $cat)
95         {
96             
if ($cat[0]==$parent)
97                 echo
"<option value=".$cat[0]." selected>".$cat[1]."</option>";
98             
else
99                 echo
"<option value=".$cat[0].">".$cat[1]."</option>";
100         }
101 ?>
102         </
select>
103         </td>
104       </tr>
105
106         <td width=
"15%" class="smallfont" align="right" valign="top">
107         Th&#
7913; t&#7921; s&#7855;p x&#7871;p</td>
108         <td width=
"1%" class="smallfont">
109         &nbsp;</td>
110         <td width=
"83%" class="smallfont">
111         <INPUT
value="<? echo $thutu; ?>" TYPE="text" NAME="thutu" CLASS=textbox size="4"></td>
112       </tr>
113       <tr>
114         <td width=
"15%" class="smallfont">
115         <p align=
"right">
116         <INPUT TYPE=
"submit" NAME="butSaveLoai" VALUE="C&#7853;p nh&#7853;t" CLASS=button>&nbsp;</td>
117         <td width=
"1%" class="smallfont">
118         &nbsp;</td>
119         <td width=
"83%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button value="Nh&#7853;p l&#7841;i"></td>
120       </tr>
121       
122     </table>
123     </td>
124   </tr>
125   </table>
126 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.882 lượt xem

Gõ tìm kiếm nhanh...